import request from '@/utils/request';
import { toFormData } from '@/utils/utils.jsx';
import { stringify } from 'qs';

// 获取账号信息
export async function getAccountInfoOp(params) {
  return request(`/blade-user/detail/000000/${params.userId}`);
}

// 获取账号余额
export async function getAccountBalanceOp(params) {
  return request(`/blade-user/user/getBalance?${stringify(params)}`);
}

// 获取银行卡信息
export async function getBankCard(params) {
  return request(`/blade-user/bankCard/bankDetails?${stringify(params)}`)
}

//费率
export async function getRechargeRateOp(params) {
  return request(`/blade-user/panRecharge/getRechargeRate?${stringify(params)}`);
}

//银联费率
export async function getUnionRechargeRateOp(params) {
  return request(`/blade-user/unionRecharge/getRechargeRate?${stringify(params)}`);
}

//表格分页（用户账单分页查询）
export async function getUserAccountListOp(params) {
  return request(`/zjf-pays-bill/user/bill/detail/page`,{
		method: 'post',
		data: params
	});
}

//表格分页（历史账单查询）
export async function getHistoryUserAccountListOp(params) {
  return request(`/zjf-oms/payorder/payOrderPageUser?${stringify(params)}`);
  }

//表格分页（商户账单分页查询）
export async function getBusiAccountListOp(params) {
  return request(`/zjf-pays-bill/merchantpayorder/pageMerchantPayOrderByErp?${stringify(params)}`);
}

//表格分页（仓储账单分页查询）
export async function getStorageAccountListOp(params) {
  return request(`/zjf-oms/payorder/payOrderPageWms?${stringify(params)}`);
}

//获取支付环节下拉
export async function getTransTypeListOp(params) {
  return request(`/zjf-pays/zjfPayCommon/transTypeList?${stringify(params)}`);
}

//关联订单号(账户余额-账单详情)
export async function getRelativeOrderSnOp(params) {
  return request(`/zjf-pays-bill/user/bill/detail/orderSn`, {
    method: 'POST',
    data: params
  });
}

//进行充值
export async function rechargeOp(params) {
  return request(`/blade-user/panRecharge/recharge`, {
    method: 'POST',
    data: params,
  });
}

//获取支付二维码
export async function getPayQrcodeOp(params) {
  return request(`/blade-user/unionRecharge/recharge`, {
    method: 'POST',
    data: params,
  });
}

//轮询刷新
export async function pollFuncOp(params) {
  return request(`/zjf-pays/pan/getPaymentStatus?${stringify(params)}`);
}

//获取商户号还是用户号
export async function getAccountType() {
  return request(`/blade-user/user/uniteUser`);
}

//判断是否是银联用户
export async function getIsUnionUser() {
  return request(`/blade-user/user/ownIsUnionTestUser`);
}

//获取商户信息支付密码绑卡等状态
export async function checkSellerStatus(params) {
  return request(`/blade-user/user/merchantIsHasPayPasswordAndBankCard`, {
    method: 'POST',
    data: params,
  });
}

// 解除银行卡
export async function cancelCard(params) {
  return request(`/blade-user/bankCard/untieBank?${stringify(params)}`);
}

// 账单详情接口
export async function getBillDetailsOp(params) {
  return request(`/zjf-wms/merchantPayOrder/merchantPayOrderBillDetail?${stringify(params)}`);
}

 //杜尚用户自动支付 view
 export async function jstAutoPayConfigViewOp() {
  return request('/zjf-oms/noneOrder/jstAutoPayConfigView');
}

//杜尚用户自动支付 config
export async function jstAutoPayConfigOp(params) {
  return request(`/zjf-oms/noneOrder/jstAutoPayConfig?${stringify(params)}`);
}

//////////////////////////////////////////////////////////////////二类户

//申请代扣签约（二次签约）
export async function applySignUpgradeOp(params) {
  return request(`/blade-user/classIIRecharge/applySignUpgrade?${stringify(params)}`);
}

//查询二类户绑卡信息
export async function queryClassIIBindCardOp() {
  return request(`/blade-user/classIIRecharge/queryClassIIBindCard`);
}

//代扣签约（二次签约）短信验证
export async function signValidOp(params) {
  return request(`/blade-user/classIIRecharge/signValid`, {
    method: 'Post',
    data: params,
  });
}

//充值发送验证码
export async function rechargeOptOp(params) {
  return request(`/blade-user/classIIRecharge/rechargeOpt`, {
    method: 'Post',
    data: params,
  });
}

//充值短信验证
export async function rechargeValidOp(params) {
  return request(`/blade-user/classIIRecharge/rechargeValid`, {
    method: 'Post',
    data: params,
  });
}

//获取认证信息
export async function getAttestation(params) {
    return request(`/zjf-pays/openAccount/getAttestationJM?${stringify(params)}`);
  }

  //绑定银行卡列表返回
export async function getBankListDetails(params) {
    return request(`/zjf-pays/openAccountV3/getBankListDetails?${stringify(params)}`);
  }

//是否开启线下充值
export async function OpenOfflineRecharge() {
    return request(`/blade-user/usercfg/isOpenOfflineRecharge`);
  }

//可抵扣金额门店统计
export async function deductionStoreListOp(params) {
  return request(`/zjf-pays/deductionBalance/storeList?${stringify(params)}`);
}
 
//门店抵扣详情分页
export async function getDeducationTableDataOp(params) {
  return request(`/zjf-pays/deductionPayOrder/page?${stringify(params)}`);
  return request(`/zjf-pays/deductionPayOrder/page`, {
    method: 'Post',
    data: params,
  });
}

//关联业务单号
export async function getDeductionRelativeOrderSnOp(params) {
  return request(`/zjf-pays/deductionPayOrder/relationOrderSn?${stringify(params)}`);
}

//修改 折扣金额
export async function upDatePrice(params) {
    return request(`/zjf-pays/deductionBalance/update`, {
      method: 'Post',
      data: params,
    });
  }

//金额调整记录
export async function amountChangeRecord(params) {
	return request(`/zjf-pays/deductionBalance/modify/record/page`, {
		method: 'post',
		data: params,
	});
}

//模糊查询下拉供应商列表 storeName：供应商名称
export async function queryFactoryList(params) {
  return request(`/blade-goods/zjfstore/list/fuzzyQueryPage?${stringify(params)}`);
}

//金额调整申请
export async function updateAmount(params) {
	return request(`/zjf-pays/deductionBalance/auditApply`, {
		method: 'post',
		data: params,
	});
}

//查询是否开启自动支付
export async function queryAutoPay(params) {
    return request(`/zjf-oms/ordercurrencyrule/query/auto/pay?${stringify(params)}`);
  }
  
//开启自动支付
export async function openAutoPay(params) {
    return request(`/zjf-oms/ordercurrencyrule/open/auto/pay?${stringify(params)}`);
  }
  
//关闭自动支付
export async function closeAutoPay(params) {
    return request(`/zjf-oms/ordercurrencyrule/close/auto/pay?${stringify(params)}`);
  }
  
//获取操作日志
export async function getOperationLogDetail(params) {
    return request(`/zjf-oms/ordercurrencyrule/query/log?${stringify(params)}`);
  }

//查询没有权限展示自动支付开关
export async function queryAutoUser(params) {
    return request(`/zjf-oms/ordercurrencyrule/auto/user?${stringify(params)}`);
  }

//自动抵扣开启关闭
export async function autoDedication(params) {
	return request(`/zjf-pays/account/autoDedication`, {
		method: 'post',
		body: toFormData(params),
	});
}

//查询是否开启自动抵扣
export async function queryAutoDedication(params) {
    return request(`/zjf-pays/account/autoDedication?${stringify(params)}`);
  }